newtios = *oldtios;
- /* Remove the echo characters and signal reception, the echo
- * will be done with master proxying */
- newtios.c_iflag &= ~IGNBRK;
- newtios.c_iflag &= BRKINT;
- newtios.c_lflag &= ~(ECHO|ICANON|ISIG);
+ /* We use the same settings that ssh does. */
+ newtios.c_iflag |= IGNPAR;
+ newtios.c_iflag &= ~(ISTRIP | INLCR | IGNCR | ICRNL | IXON | IXANY | IXOFF);
+ newtios.c_lflag &= ~(TOSTOP | ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHONL);
+ newtios.c_oflag &= ~ONLCR;
+ newtios.c_oflag |= OPOST;
newtios.c_cc[VMIN] = 1;
newtios.c_cc[VTIME] = 0;